package main

import (
	"encoding/json"
	"flag"
	"fmt"
	"os"

	"github.com/ChuranNeko/gginx/pkg/version"
)

type VersionInfo struct {
	Version string `json:"version"`
}

func main() {
	jsonFlag := flag.Bool("json", false, "output version as JSON")
	flag.Parse()

	if *jsonFlag {
		info := VersionInfo{Version: version.String()}
		json.NewEncoder(os.Stdout).Encode(info)
	} else {
		fmt.Println(version.String())
	}
}
